﻿@model PortalBusiness.Models.CAIXA

@{
    ViewBag.Title = "Incluir";
}


@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    

    <div class="form-horizontal">
        @Html.HiddenFor(model => model.CAIXAID)
        <h4>CAIXA</h4>
        <hr />
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    @Html.LabelFor(model => model.DATA, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.DATA, new { htmlAttributes = new { @class = "form-control" , @disabled="disabled"} })
                        @Html.ValidationMessageFor(model => model.DATA, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.CAIXA_OBSERVACAO, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.CAIXA_OBSERVACAO, new { htmlAttributes = new { @class = "form-control" } })
                        @Html.ValidationMessageFor(model => model.CAIXA_OBSERVACAO, "", new { @class = "text-danger" })
                    </div>
                </div>



                <div class="form-group">
                    @Html.LabelFor(model => model.CAIXA_SANGRIA, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        <!--<input name="CAIXA_SANGRIA" type="text" id="CAIXA_SANGRIA" value="@Model.CAIXA_SANGRIA" class="form-control moeda " disabled>-->
                        @Html.EditorFor(model => model.CAIXA_SANGRIA, new { htmlAttributes = new { @class = "form-control moeda", @disabled = "disabled" } })
                        @Html.ValidationMessageFor(model => model.CAIXA_SANGRIA, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.CAIXA_TOTAL, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        <!--<input name="CAIXA_TOTAL" type="text" id="CAIXA_TOTAL" value="@Model.CAIXA_TOTAL.ToString()" class="form-control moeda " disabled>-->
                        @Html.EditorFor(model => model.CAIXA_TOTAL, new { htmlAttributes = new { @class = "form-control moeda", @disabled = "disabled" } })
                        @Html.ValidationMessageFor(model => model.CAIXA_TOTAL, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.CAIXA_FITA, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        <!--<input name="CAIXA_FITA" type="text" id="CAIXA_FITA" class="form-control moeda " >-->
                        @Html.EditorFor(model => model.CAIXA_FITA, new { htmlAttributes = new { @class = "form-control moeda" } })
                        @Html.ValidationMessageFor(model => model.CAIXA_FITA, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.CAIXA_QUEBRA, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        <!--<input name="CAIXA_QUEBRAZ" type="text" id="CAIXA_QUEBRA" value=@Model.CAIXA_QUEBRA class="form-control moeda " disabled>-->
                        @Html.EditorFor(model => model.CAIXA_QUEBRA, new { htmlAttributes = new { @class = "form-control moeda", @disabled = "disabled" } })
                        @Html.ValidationMessageFor(model => model.CAIXA_QUEBRA, "", new { @class = "text-danger" })
                    </div>
                </div>


                <div class="form-group">
                    @Html.LabelFor(model => model.STATUS, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.DropDownList("STATUS", null, new { @class = "form-control" })
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-md-offset-2 col-md-10">
                        <input type="submit" id="salvar" value="Salvar" class="btn btn-default" />
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                @{ViewBag.Contador = 0;}
                @foreach (PortalBusiness.Models.CAIXA_COLUNA item in Model.COLUNAS)
                {
                    <div class="form-group">
                        @Html.Label(item.NOME, htmlAttributes: new { @class = "control-label col-md-2" })
                        <div class="col-md-10">
                            @{ double ValorAux = Model.VALORES[ViewBag.Contador];
                             ViewBag.TextAux = ValorAux.ToString("####0.00");
                            }
                            <input name="VALORES[@ViewBag.Contador]" type="text" id='@("VALORES"+ViewBag.Contador)' value="@ViewBag.TextAux" class="form-control moeda coluna" />
                            <input name="ID_COLUNAS[@ViewBag.Contador]" type="text" id='@("ID_COLUNAS" + ViewBag.Contador)' value="@item.COLUNAID" class="hide" />
                        </div>
                    </div>
                    ViewBag.Contador += 1;
                }
            </div>
        </div>
    </div>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/jquery-ui")
    @Scripts.Render("~/Scripts/jquery.price_format.2.0.js")
    @Scripts.Render("~/Scripts/CaixaIncluir.js")
}
